'use strict';const _Wr={[_vd]:{name:"Tab opens",title:"A tab is opened",help:"opn"},[_Lr]:{name:"Tab closes",title:"A tab is closed",help:"cls"},[_uw]:{name:"Tab activates",title:"A tab is activated",help:"act"},[_bs]:{name:"Tab deactivates",title:"A tab is deactivated",help:"dAct"},[_5f]:{name:"Tab focuses",title:"A tab is focused",help:"foc"},[_vf]:{name:"Tab unfocuses",title:"A tab is unfocused",help:"uFoc"},[_vw]:{name:"Tab load begins",title:"A tab starts loading a page",help:"ldB"},[_Qo]:{name:"Tab load ends",
title:"A tab finishes loading a page",help:"ldE"},[_j]:{name:"Tab unloads",title:"A tab's content is unloaded",help:"uld"},[_me]:{name:"Tab URL changes",title:"A tab's URL changes",help:"uChg"},[_8j]:{name:"Tab audio starts",title:"A tab starts playing audio",help:"audB"},[_ve]:{name:"Tab audio stops",title:"A tab stops playing audio",help:"audE"},[_Yd]:{name:"Window opens",title:"A window is opened",help:"wOpn"},[_vr]:{name:"Window closes",title:"A window is closed",help:"wCls"},[_6h]:{name:"Window focuses",
title:"A window is focused",help:"wFoc"},[_Gp]:{name:"Window unfocuses",title:"A window is unfocused",help:"wUnf"},[_fd]:{name:"Window minimizes",title:"A window is minimized",help:"min"},[_wh]:{name:"Window unminimizes",title:"A window is unminimized",help:"uMin"},[_Y]:{name:"Toolbar btn",title:"A toolbar button is clicked",help:"tbb"},[_sd]:{name:"Clipbrd changes",title:"The clipboard changes",help:"cbC"},[_go]:{name:"External event",title:"External app event",help:"ext"},[_Ae]:{name:"On startup",
title:"AutoControl starts up",help:"stu"}};function _1s(l){l=_3j(l);return l.type==_Xs?_d(l.num)?_Wr[_Y].name+" "+_5a(l.num-_Y):_Wr[l.num].name:l.isDownUp?_jf(l.num):""}
let _Fh=(()=>{function l(a){if(a.mouseMove)var b="<gest>"+a.mouseMove+"</gest>";else{var c=a.eventId||a.keyEvt;if(c&&(b=_1s(c),c=_3j(c)))if(c.type!=_Xs){var d=c.type==_Go?a.toggleState?"off":"up":a.toggleState?"on":"down";a.holdPeriod&&(d+=" hold")}else if(_d(c.num))var e="iconUID=TBBtn"+(c.num-_Y),f={[_mw]:"L",[_7r]:"R",[_vt]:"M",[_Be]:"4th",[_ny]:"5th"}[a.btnId];else c.num==_go&&a.evtName&&(b=`<b>Extern:</b> <n>${a.evtName}</n>`)}if(b){c=_ao;var k=a.mouseMove?_Lk:_wf(a.eventId||a.keyEvt);a=`<event class="${c(k)} ${d||
""}" ${e||""} title="Click for options">${b}<d>${f||""}</d>${1<a.repCount?"<r>"+a.repCount+"</r>":""}</event>`}else a="";return a}function y(a,b,c){delete a.eventId;delete a.voiceCmd;delete a.block;delete a.btnId;"E"==b?(delete a.mouseMove,b=_3j(c),a.eventId=c,a.block=c.in(_7r,_Be,_ny)?_Ke:c==_mw&&a.preconds.length||!c.in(_mw,_Uh,_8h,_rj,_ds,_my,_Xk)?_Hr:_Sf,b.type!=_Xs||_d(b.num)||a.wildcard!=_Ly||0!=a.preconds.length||(a.wildcard=_vg)):"G"==b&&(delete a.holdPeriod,delete a.repCount,b=_Iy(c.state),
"I"==b?a.mouseMove="":"C"==b?a.mouseMove+=_Iy(c.dir):"S"!=b||a.mouseMove||J(a))}function K(a){a=_3j(a,!0);return a.isDownUp&&(a.devId!=_Lk||!("miscNum"in a))}function z(a,b){b=_3j(b);if(!b.isDownUp)return!1;for(let c of a.preconds||[])if(_3j(c.keyEvt).num==b.num)return!0;return(a=_3j(a.eventId))&&a.isDownUp&&a.num==b.num}function p(a){var b=a.closest("trigger");b=_Xt(b);a=$(a).closest("triggers")[0].value;return _ih(a,b)}function q(a){a=$(a).closest("combin")[0];return _ih(p(a),"combins",_Xt(a))}
function A(a){var b=$(a).closest("combin");let c=q(b);b=b.find("event");a=b.index(a);return a==b.length-1?c:c.preconds[a]}function B(a){$(">cont",a).html(L(q(a)))}function C(a,b,c,d){if(!$("gestAssistPane")[0]||"G"==b){var e=q(a);{let f=_ih(e,"preconds",[]);e.eventId&&K(e.eventId)?"E"==b&&z(e,c)||(f.push({keyEvt:e.eventId}),y(e,b,c)):e.eventId||e.mouseMove?"E"==b&&K(c)?z(e,c)||f.push({keyEvt:c}):y(e,b,c):y(e,b,c)}d&&e.add(d);B(a);c.in(_mw,_mw|_Go)&&u(a,!1)}}function W(a){let b=c=>{let d=_Wr[c];return`<div evtId=${c}>${d.title} ${d.help?
`<h h=${d.help}></h>`:""}</div>`};return $(`\n <envEvtsMenu helpCtx=env/evts>\n <group>\n ${b(_Y)}\n <hr>\n ${b(_vd)}\n ${b(_Lr)}\n ${b(_uw)}\n ${b(_bs)}\n ${b(_5f)}\n ${b(_vf)}\n <hr>\n ${b(_vw)}\n ${b(_Qo)}\n ${b(_j)}\n ${b(_me)}\n </group>\n <group>\n ${b(_sd)}\n <hr>\n ${b(_8j)}\n ${b(_ve)}\n <hr>\n ${b(_Yd)}\n ${b(_vr)}\n ${b(_6h)}\n ${b(_Gp)}\n ${b(_fd)}\n ${b(_wh)}\n <hr>\n ${b(_Ae)}\n <!--\n ${b(_go)}\n -->\n </group>\n </envEvtsMenu>\n `).on("click","div[evtId]",_Et(function*(c){c=+$(this).attr("evtId");
if(c==_Y){var d=yield _Jp();if(d.length)c+=d[0],d={btnId:_hf._si.in("opera","vivaldi")?0:_mw};else return _yt("You haven't added any toolbar buttons yet. <br> Go to the <b>Options</b> tab, under section <b>Custom Toolbar Buttons</b>.")}$(this).triggerEvt("focusLost",!0);C(a,"E",c|_Xs,d)}))}function D(a){let b=$(a).closest("triggers").is("[gestureConf]"),c=$(`\n <combEditBar popupCntr title="">\n <cont>\n <bar1><h h=${b?"edtCmbG":"edtCmb"}></h></bar1>\n <bar2>\n <btn gest title="Enter a mouse gesture">\n <i mouseGestDirs dirs></i>\n </btn>\n <btn evts>Events</btn>\n </bar2>\n </cont>\n </combEditBar>\n `);
c.on("mousedown","btn[gest]",function(d){v(!0,d)}).on("mousedown","btn[evts]",function(){_Jh(W(a),this,"brlt","tailAndShadow noTail")}).on("mousedown",function(d){d.stopPropagation()});setTimeout(()=>{$(window).captureEvt("mousedown.combinEdit",function(d){if(!v(!1)){d=$(d.target);var e;d.closest("combEditBar")[0]||d.closest("envEvtsMenu")[0]||(d.closest("combin.edit event")[0]?E():(e=d.closest("combin.edit")[0])?C(e,"E",_mw):E())}}).on("blur.combinEdit",()=>E())},150);$(a).closest("triggers").addClass("editing");
$(a).append(c).addClass("edit").css("min-width",$(a).css("width"));z(q(a),_mw)||u(a,!0);_hf._Nf(!0,(d,e)=>{let f;"E"==d&&(e==(_7r|_Go)||e==_7r&&(f=$(":hover").last().closest("combin.edit event")[0]))?e==_7r&&M(f,!1):C(a,d,e)});_qf("mouseGest","params","dirPrecision")(d=>{$("[dirs]",c).attr("dirs",d||8)});c.enableResizeEvent().on("resize",function(){$("btn[gest], h",this).triggerEvt("resize")});setTimeout(()=>{let d=$("trigActList combin");1==d.length&&d.is(".edit")&&0==$("event",d).length&&0==$(".popup",
c).length&&!_Do&&$("h",c).triggerEvt({mousedown:!0})},400)}function u(a,b){$(a).toggleClass("lftBtnInput",b).attr("title",b?"A Left click here enters a Left Btn.":"")}function E(){if(0!=$("combin.edit").length){v(!1);_hf._Nf(!1);$(window).off(".combinEdit").delEvtCapture(".combinEdit");var a=$("combin.edit:has(>combEditBar)");a.length&&(a.closest("triggers").removeClass("editing"),a.removeClass("edit").css("min-width","").find(">combEditBar").remove(),u(a,!1),_nt(a),0==$("> cont > event",a).length?
F(a[0]):a.closest("trigger").removeClass("empty"))}}function F(a){let b=p(a);b.combins.splice(_Xt(a),1);_nt(a);$(a).closest("trigger").toggleClass("empty",!b.combins.length);$(a).closest("combinSeq").html(w(b.combins))}function M(a,b=!0){var c=A(a);let d=$(a).closest("combin")[0];(c.eventId||c.keyEvt||0).in(_mw,_mw|_Go)&&u(d,!0);if(c.keyEvt)a=q(a),c=a.preconds.indexOf(c),a.preconds.splice(c,1);else if(!J(c)&&b)return F(d);b&&_nt(d);B(d)}function J(a){let b=(a.preconds||[]).pop();delete a.eventId;
delete a.mouseMove;delete a.voiceCmd;return b?(a.eventId=b.keyEvt,a.block=!0):!1}function X(a){return $(`\n <gestAssistPane>\n <p1 hl>Move your mouse now.</p1>\n <p1>Once your gesture is done,<br>finish with <u>left click</u>.</p1>\n <p2>\n <p2a>Gesture precision:<v dirs=${a}>directions<i mouseGestDirs dirs=${a}></i></v></p2a>\n <p2b>(change this in the options tab)</p2b>\n </p2>\n </gestAssistPane>\n `)}function Y(a){this.svg=_ne("mouseGestureCanvas",void 0,t).appendTo("body")[0];this.polyline=$(">polyline",
this.svg)[0];this.addPoint=function(b,c){let d=this.svg.createSVGPoint();d.x=b;d.y=c;this.polyline.points.appendItem(d)};this.addPoint(a.x,a.y);this.mouseMoveCallback=b=>{this.addPoint(b.clientX,b.clientY)};$(document).on("mousemove",this.mouseMoveCallback);this.destroy=function(b=1E3){$(document).off("mousemove",this.mouseMoveCallback);$(this.svg).css({transition:b+"ms opacity",opacity:0,pointerEvents:"none"});setTimeout(()=>{$(this.svg).remove();delete this.svg},b)}}function n(a){let b=$(l(A(a)))[0];
a.popupElem&&(a.popupElem.popupTriggerElem=$(b).prop("popupElem",a.popupElem).addClass("popup")[0]);$(a).replaceWith(b);return b}function Z(a){a=_3j(a);return a.isDownUp&&a.num.in(_nr,_Cr,_Nu)}function aa(a){let b=_ne("combinOptionsPane",void 0,t),c=q(a),d=_3j(c.eventId)||{};d.type!=_Xs||_d(d.num)||$("div[wildcard]",b).addClass("envEvt");$("div[wildcard] select",b).val(c.wildcard||_ak).change(function(){c.wildcard=+this.value;B(a);$(this).triggerEvt("resize",!0);_nt(a)});$(a).is(":not(:first-of-type)")&&
$("div[maxTime]",b).css("display","block").find("input").prop("value",c.maxTime||"").change(function(){(c.maxTime=+this.value)||delete c.maxTime;_nt(a)});$(a).is(":not(:first-of-type)")&&$("div[antiSeq]",b).css("display","block").find("input").prop("checked",c.negateSeq).change(function(){c.negateSeq=this.checked;$(a).prevAll("sep:first").toggleClass("negate",this.checked);_nt(a)});$("btn[del]",b).dblclick(function(){$(this).triggerEvt("focusLost",!0);F(a)});$("btn[edit]",b).click(function(){$(this).triggerEvt("focusLost",
!0);D(a)});return b}function N(a){let b=p(a),c=_Xt(a);_ih(b,"combins",[]).splice(c,0,{wildcard:_Ly});a=$(a).closest("combinSeq").html(w(b.combins)).find(">combin").eq(c)[0];D(a)}function L(a){var b={[_Ly]:"",[_vg]:"<wc>*</wc>",[_Li]:'<event class="keybrd wc">*</event>',[_xj]:'<event class="mouse wc">*</event>'};b=(b=a.wildcard in b?b[a.wildcard]:"<wc>**</wc>")?b+" + ":"";for(let c of a.preconds||[])b+=l(c)+" + ";return b+l(a)}function w(a){let b="";if(!a.length)return"<combin class=empty>Enter a trigger for the action</combin>";
for(let c=0;c<a.length;++c){let d=a[c];b+=`\n <sep button actBtn hh=newCmb class="${d.negateSeq?"negate":""}"></sep>\n <combin><cont>${L(d)}</cont><b></b></combin>\n `}return b+"<sep button actBtn hh=newCmb></sep>"}function G(a,b="urlTests"){let c=_Kg(a,"preconds",b),d="evtUrl"==b;return _Pt(c)||d&&!O(a)?"":_Bj`\n <precondMulti name=${b} value=[]>\n <wrap>\n <l>${"evtUrl"==b?"Event ":""}URL:</l>\n <content>${c.map(ba)}</content>\n </wrap>\n <h h="${d?"evtUrl2":"urlPr2"}"></h>\n </precondMulti>\n `}
function ba(a){return`\n <urlTest precond value={}>\n ${_Qp([[_Bs,["Whole URL","full"]],[_ld,["Domain","dom"]],[_ss,["Main domain","mDom"]],[_Ay,["Path","pth"]]],"part",a.part,"","number helpCtx")}\n ${_Qp({0:["does","ds"],1:["doesn't","dnt"],[_Ff]:["must","mst"]},"negate",a.negate|0,"","number helpCtx")}\n ${_ow({equals:"match exactly",contains:"contain",starts:"start with",ends:"end with"},a.type,"type")}\n ${_if("value",a.value,"Enter text","autoDim")}\n <del button>&#xD7;</del>\n </urlTest>\n `}
function P(a){return(a=_Kg(a,"preconds","chromeState"))?`\n <precond name=chromeState value={}>\n <wrap>\n Browser state:\n <label>${_io("active",a.active)}<l>Focused</l></label>\n <label>${_io("inactive",a.inactive)}<l>Unfocused</l></label>\n <label>${_io("closed",a.closed,"perms=bg")}<l>Closed</l></label>\n <del button>&#xD7;</del>\n </wrap>\n <h h=brwSt></h>\n </precond>\n `:""}function Q(a){return(a=_Kg(a,"preconds","caretState"))?`\n <precond name=caretState value={}>\n <wrap>\n Text cursor:\n <label>${_io("on",
a.on)}<l>On</l></label>\n <label>${_io("omnibox",a.omnibox)}<l>Omnibox</l></label>\n <label>${_io("off",a.off)}<l>Off</l></label>\n <del button>&#xD7;</del>\n </wrap>\n <h h=crtSt></h>\n </precond>\n `:""}function R(a){a=_bt(_Kg(a,"preconds","menuState"));return _Pt(a)?"":_Bj`\n <precondMulti name=menuState value=[]>\n <wrap>\n <l>Menu:</l>\n <content>${a.map(b=>`\n <menuState precond value={}>\n ${_wt("menuSpec","menuId",b.menuId,"(any menu)","(any menu)",!1,!1)}\n ${_ow({0:"is open",1:"isn't open"},
b.negate,"negate","bool hard")}\n <del button>&#xD7;</del>\n </menuState>\n `)}</content>\n \n <!--label>\${makeRadioButton(true, 'open', state)}<l>Visible</l></label>\n <label>\${makeRadioButton('', 'closed', state)}<l>Not visible</l></label-->\n </wrap>\n <h h=menuSt></h>\n </precondMulti>\n `}function S(a){a=_Kg(a,"preconds","mouseOver");return _Pt(a)?"":_Bj`\n <precondMulti name=mouseOver value=[]>\n <wrap>\n <l>Mouse:</l>\n <content>${a.map(b=>`\n <mouseOver precond value={}>\n ${_ow({or:"Over",
not:"Not over"},b.oper,"oper")}\n ${_bp(T,"mseOvrRegions","region",b.region,void 0,"number helpCtx")}\n <del button>&#xD7;</del>\n </mouseOver>\n `)}</content>\n </wrap>\n <h h=mseOvr></h>\n </precondMulti>\n `}function U(a){a=_Kg(a,"preconds","swtchState");return _Pt(a)?"":_Bj`\n <precondMulti name=swtchState value=[]>\n <wrap>\n <l>Switch:</l>\n <content>${a.map(b=>`\n <swtchState precond value={}>\n ${_Ee("swtchId",b.swtchId)}\n ${_ow({1:"is ON",0:"is OFF"},b.state,"state","bool hard")}\n ${_ow({"&":"AND",
"|":"OR","=":"EQUAL"},b.oper,"oper")}\n <del button>&#xD7;</del>\n </swtchState>\n `)}</content>\n </wrap>\n <h h=swchSt></h>\n </precondMulti>\n `}function V(a={}){return`\n <trigger ${_Pt(a.combins)?"class=empty":""}>\n <ctrl><del button title="Delete this trigger">&#xD7;</del></ctrl>\n <combinSeq>${w(a.combins||[])}</combinSeq>\n <preconds value={}>\n ${P(a)}\n ${Q(a)}\n ${G(a)}\n ${G(a,"evtUrl")}\n ${S(a)}\n ${R(a)}\n ${U(a)}\n </preconds>\n <add button title="Add a condition">Condition</add>\n ${_mr(a)?
"\n <foreign>\n <cont>\n This is a global trigger being synchronized from another AutoControl installation. <hr b>\n Enable the trigger only if you understand the consequences. <br>\n <div> <h h=enTrig></h> <button>Enable trigger</button> </div>\n </cont>\n </foreign>\n ":""}\n </trigger>\n `}function O(a){return(a=_3j(_Kg(a.combins,-1,"eventId")))&&a.type==_Xs&&a.num<_f}function ca(a){let b=p(a);return $(`\n <precondsMenu>\n <item value=urlTests>URL <h h=urlPr></h></item>\n ${O(b)?"<item value=evtUrl>Event URL <h h=evtUrl></h></item>":
""}\n <item value=chromeState ${_Kg(b,"preconds","chromeState")?"greyedout":""}>Browser state <h h=brwSt></h></item>\n <item value=caretState ${_Kg(b,"preconds","caretState")?"greyedout":""}>Text cursor <h h=crtSt0></h></item>\n <item value=mouseOver>Mouse over <h h=mseOvr></h></item>\n <item value=menuState>Menu state <h h=menuSt></h></item>\n <item value=swtchState>Switch state <h h=swchSt0></h></item>\n </precondsMenu>\n `).on("click","item",function(){let c=$(this).attr("value"),d=a.closest("trigger");
var e=p(d);if(c.in("urlTests","evtUrl")){let k=_ih(e,"preconds",c,[]);if(!k.length||Object.keys(k[k.length-1]).length){k.push({part:_Bs,negate:0});var f=G(e,c)}}else"chromeState"==c?(_ih(e,"preconds",c).active=!0,f=P(e)):"caretState"==c?(_ih(e,"preconds")[c]={on:!0,off:!0,omnibox:!0},f=Q(e)):"menuState"==c?(f=_bt(_Kg(e,"preconds","menuState"))||[],_ih(e,"preconds",c,f).push({menuId:0,state:!0}),_nt(this),f=R(e)):"mouseOver"==c?(_ih(e,"preconds",c,[]).push({region:_ou}),_nt(this),f=S(e)):"swtchState"==
c&&(_ih(e,"preconds",c,[]).push({state:!0}),f=U(e));f&&(e=f,f=$(e).attr("name"),f=$(`preconds [name=${f}]`,d),f[0]?f.replaceWith(e):$("preconds",d).append(e));c.in("urlTests","evtUrl")&&$("urlTest:last-of-type input",d).focus();$(this).triggerEvt("focusLost",!0)}).on("close",function(){this.remove()})}const t=document.currentScript.parentElement,da=(a,b)=>_ne(a,b,t);{let a=!1,b;var v=function(c,d){if(c!=a&&(c||b)){a=c;_hf._So(_qh,a);c=$("combEditBar btn[gest]");var e=c.closest("trigAct");if(e[0]){var f=
e.find("+ sep");a?(_Jh(X($("[dirs]",c).attr("dirs")),c,"bltr","tailAndShadow noTail"),e.css({width:e.css("width"),top:e[0].offsetTop}).addClass("offline"),f.css(e.css(["width","height"])),_Bd(()=>b=new Y({x:d.clientX,y:d.clientY}))):(e.add(f).removeClass("offline").css({width:"",height:""}),b.destroy(700),b=null);return!0}}}}let fa=_Et(function*(a,b){let c=_ne("eventOptionsPane",void 0,t),d=A(a),e=_3j(d.eventId||d.keyEvt,!0);if(e&&e.devId==_ps){var f=_Kg(_Ci,e.num,1);if(f){$("div[variant]",c).css("display",
"block").change(function(g){let h="eventId"in d?"eventId":"keyEvt";d[h]=g.target.value|_3j(d[h]).type;a=n(a);_nt(a)});f=_Mg(f)?e.num:f;var k=_Ci[f][1],H=c.find("div[variant] select")[0];for(var m of[k[0],k[1],f])H.options.add(new Option((m==f?"Any ":"")+_Ci[m][0],m,!1,m==e.num))}}m=_Yh(e);d.eventId&&(f=+(e.type==_Go),m?($("div[action], div[holdDown]",c).css("display","block"),$("div[action] select",c).val(f).change(function(){let g=$("div[block] select:visible",c)[0];if(g){const h=+g.value;1==+this.value&&
h&&!g.noAutoUncheck&&(g.value=_Sf,$(g).triggerEvt("change",!0),g.prevValue=h);0==+this.value&&(h?g.noAutoUncheck=!0:g.prevValue&&(g.value=g.prevValue,$(g).triggerEvt("change",!0)))}d.eventId=_3j(d.eventId).num|(+this.value?_Go:_Ku);$("div[holdDown]",c).attr("greyedout",+this.value?"":null);$("div[autoRep]",c).attr("greyedout",+this.value||e.devId!=_ps&&!d.holdPeriod?"":null);a=n(a);_nt(a)}),$("div[holdDown] input",c).val((d.holdPeriod|0)/1E3).change(function(){d.holdPeriod=1E3*this.value;$("div[autoRep]",
c).attr("greyedout",e.devId==_ps||d.holdPeriod?null:"");a=n(a);_nt(a)}),f&&$("div[holdDown]",c).attr("greyedout",""),(f||e.devId!=_ps&&!d.holdPeriod)&&$("div[autoRep]",c).attr("greyedout","")):e.devId==_Lk&&$(`div[${e.num==_af?"vertDir":"horzDir"}]`,c).css("display","block").find("select").val(f).change(function(){d.eventId=_3j(d.eventId).num|(+this.value?_Go:_Ku);a=n(a);_nt(a)}),m&&$(a).closest("combin").is(":last-of-type")&&$("div[autoRep]",c).css("display","block").find("input").prop("checked",
d.noAutoRep).change(function(){d.noAutoRep=this.checked;_nt(a)}));d.keyEvt&&($("div[state]",c).css("display","block"),Z(d.keyEvt)&&$("div[state]",c).addClass("lockKey"),f=+(e.type==_Go)+2*(d.toggleState|0),$("div[state] select",c).val(f).change(function(){d.keyEvt=_3j(d.keyEvt).num|(this.value&1?_Go:_Ku);d.toggleState=!!(this.value&2);$("div[block]",c).attr("greyedout",0<this.value?"":null);a=n(a);_nt(a)}),0<f&&$("div[block]",c).attr("greyedout",""),f=$("div[block] h",c),f.attr("h",f.attr("h2")));
d.eventId&&e.isDownUp&&($("div[repeat]",c).css("display","block"),$("div[repeat] input",c).val(d.repCount||1).change(function(){d.repCount=+this.value;a=n(a);_nt(a)}));e&&e.devId.in(_ps,_Lk)&&($("div[block]",c).css("display","block").toggleClass("prsblBtn",m),$("div[block] select",c).val(+d.block||0).focus(function(){this.lastValue=this.value}).change(_Et(function*(g){this.blur();var h=g.originalEvent.isTrusted,r=_3j(d.eventId,!0)||{};const x=r.type==_Go&&_Yh(r);var I=0==_Xt($(a).closest("combin"));
g=+this.value;I=r.num==_mw&&(!x&&g!=_Sf||x&&g==_Ke)&&_Pt(d.preconds)&&I;r=g==_Hr&&x&&!this.noAutoUncheck;h&&(r||I)?(h=e.devId==_ps?"key":"button",this.value=this.lastValue||_Sf,r?h=yield _Yo("",da("overrideReleaseWarning",{keyName:h}),{yes:"I understand, override anyway",no:"Don't override",icon:"warning",width:"initial"}):(yield ea=>_yt(_ne("overrideLeftBtnWarning",void 0,t),{width:"initial"},ea),h=!0),h&&(this.value=g,$(this).triggerEvt("change",!0))):(h&&this.lastValue==_Hr&&(delete this.prevValue,
x&&(this.noAutoUncheck=!0)),d.block=g,_nt(a))})));m=(k=e&&e.type==_Xs)&&_d(e.num);f=k&&e.num==_go;k=k&&e.num==_sd;if(m){H={}.add((yield _Jp()).map(h=>[h,`<c iconUID=TBBtn${h}>Button ${_5a(h)}</c>`]));let g={0:"Left click",[_mw]:"Left press",[_7r]:"Right press",[_vt]:"Middle press",[_Be]:"4th press",[_ny]:"5th press"};$(`\n <div style="display: block"><l>Toolbar btn:</l> ${_Qp(H,"",e.num-_Y,"","number")} <h h=tbBtnSel></h></div>\n <div style="display: block"><l>Method:</l> ${_ow(g,d.btnId,"btnId",
"number")} <h h=tbBtnMtd></h></div>\n `).prependTo(c).change(h=>{"btnId"==h.target.name?d.btnId=_pu(h.target):d.eventId=_pu(h.target)+_Y|_Xs;a=n(a);_nt(a)})}else k?$(`\n <div style="display: block">&nbsp; Content: ${_ow([[0,"(any type)"],[_hj,"Text"],[_pe,"Formatted text"],[_Ga,"Image"],[_O,"Files/Folders"]],d.clipFmt,"clipFmt","number")} <h h=clpFmt></h></div>\n <div style="display: block"><label>${_io("diffCont",d.diffCont)}Only if different content</label> <h h=clpDiff></h></div>\n `).prependTo(c).change(g=>
{d[g.target.name]=_pu(g.target);a=n(a);_nt(a)}):f&&$(`\n <div style="display: block">&nbsp; Event name: ${_if("evtName",d.evtName)} <h h=evtn></h></div>\n `).prependTo(c).change(g=>{d.evtName=g.target.value;a=n(a);_nt(a)});!d.mouseMove&&e&&(e.devId!=_Ju||m||k||f)&&$("noParams",c).hide();d.mouseMove||$("[editGest]",c).hide();$("btn[del]",c).dblclick(function(){$(this).triggerEvt("focusLost",!0);M(a)});$("[editGest]",c).click(function(g){$(this).triggerEvt("focusLost",!0);let h=$(a).closest("combin");
D(h);setTimeout(()=>v(!0,g))});b(c)}),T={mseOvrRegions:_Dr([[_ou,["Browser window","brwW"]],[_Cd,["Web page","webP"]],[_Ea,["Title area","titA"]],[_Ni,["Browser tab","tab"]],[_Tw,["Tab's close button","tabX"]],[_Os,["Tab's speaker icon","tSpk"]],[_ew,["New tab button","ntb"]],[_ip,["Toolbar","tBar"]],[_Ue,["Omnibox","omnb"]],[_Wp,["Bookmark button","bmrk"]],[_ot,["Browser menu button","brMn"]],[_fg,["Any menu item","miA",!0]],[_6g,["Menu item: tab","miTb"]],[_Wi,["Menu item: tab submenu","miTG"]],
[_Dj,["Menu item: closed tab","miCT"]],[_5o,["Menu item: closed window","miCW"]],[_ur,["Menu item: bookmark","miBK"]],[_ys,["Menu item: bookmark folder","miBF"]],[_5t,["Menu item: action","miAc"]],[_yo,["Menu item: switch","miSw"]]])};return{make:function(a=[],b="",c={}){0==a.length&&a.push({});return _Bj`\n <triggers trigOrAct DataModule helpCtx="/triggers" popupCntr ${_Pt(_Kg(a,0,"combins"))?"class=empty":""} name="${b}" value=$${a} ${c.extraAttrs||""}>\n <header>${c.title||"Trigger"} <selector><list></list><add button actBtn hh=addTrg></add></selector></header>\n <content>${a.map(V)}</content>\n </triggers>\n `},
setEvtLtnrs:function(a){_ih($(a)[0],"optionsCollection").add(T);return $(a).attr("optionsCollection","").on("click","combinSeq sep",_Ow(-400,function(){N(this)})).on("mousedown","combinSeq combin.empty",function(){N(this)}).on("mousedown","combin:not(.edit) event:not(.popup)",function(b){fa(this,c=>_Jh(c,this,"btrl","tailOnly noTail"));b.stopImmediatePropagation()}).on("contextmenu","combin event",!1).on("mousedown","combin:not(.empty):not(.edit)",function(){let b=aa(this);_Jh(b,this,"b)t)r<l<","tailOnly noTail")}).on("mousedown",
"preconds + add",function(){_Jh(ca(this),this,"btrl","borderAndShadowSimple noTail")}).on("click","precond [type=checkbox]",function(b){0==$(this).closest("precond").find("input:checked").length&&(b.preventDefault(),b.stopImmediatePropagation(),setTimeout(()=>this.clickCount=0,2E3),this.clickCount=(this.clickCount|0)+1,this.helpBubble||3!=this.clickCount||(this.helpBubble=_Jh("<help noPopupAround dontCloseOnFocusLost><nobr>At least 1 option must be selected</nobr></help>",this,"btrl","infoBubble small",
"","opacity"),setTimeout(()=>{$(this.helpBubble).triggerEvt("close");this.helpBubble=null},2500)))}).on("change","preconds",function(b){p(this).preconds=_pu(this);_nt(this)}).on("click","preconds [name=chromeState] input",function(b){"closed"==this.name&&_Qk("trigActList.*.triggers","mouseGest.triggers.*",c=>{_Xd(c)});if(_hf._Ed){b=p(this);let c=_pu(this.closest("[name=chromeState]"));_ih(b,"author",_hf._Dy,c.inactive||c.closed?1:void 0,NaN)}}).on("dblclick","[precond] > del, precond del",function(){let b=
$(this).closest("precond, [precond]");"chromeState"==b.attr("name")&&_Qk("trigActList.*.triggers","mouseGest.triggers.*",c=>{_Xd(c)});_rg(b)&&_dj(500);b.is(":only-of-type")&&(b=b.closest("preconds > *"));b.parent().triggerEvt("change",!0,!0);b.remove()}).on("click","foreign button",function(){let b=p(this);_ih(b,"author",_hf._Dy,1,NaN);_nt(this);this.closest("foreign").remove()}).on("click","triggers > header add",function(){let b=$(this).closest("triggers")[0];0==$("trigger.empty:last-of-type",b).length&&
$("> content",b).append(V())}).on("dblclick","trigger > ctrl del",function(){let b=$(this).closest("triggers")[0],c=$(this).closest("trigger");_rg(c)&&_dj(600);let d=_Xt(c);b.value.splice(d,1);c.remove();_nt(b)}).on("change","triggers",function(){$(this).toggleClass("empty",!$("sep:visible",this).length)})},makeCombinSeqContent:w}})();
